import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入组件
import Home from '../layout/Home'
import Found from '../views/FoundMusic'
import My from '../views/MineMusic'
import Discover from '../views/FoundMusic/Discover'
import TopList from '../views/FoundMusic/TopList'

// 使用插件
Vue.use(VueRouter)

// 声明路由的配置(route 代表路由，router代表路由器)
const routes = [
  // 一级路由，在App.vue中展示
  {
    path: '/',
    // 默认展示首页 - 只要访问了根路劲，就默认跳转到首页去
    redirect: '/found',
    component: Home,
    // 二级路由， 在一级路由对应的组件中展示 Home
    children: [
      {
        path: '/found',
        // path: '/',
        component: Found,
        // 三级路由，在二级路由对应的组件中展示， Found
        children: [
          {
            path: '/found',
            component: Discover
          },
          // 根据二级路由来的三级路由名称，建议带上前面的内容
          {
            path: '/found/top',
            component: TopList
          }
        ]
      },
      {
        path: '/my',
        component: My
      }
    ]
  }
]

// 导出实例
export default new VueRouter({
  routes
})
